package com.org.redis.config;

import org.redisson.Redisson;
import org.redisson.config.Config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

/**
 * redisson
 * @author wang
 */
@Configuration
public class RedissonConfig extends Redis{

    @Bean
    public Redisson redisson(){
        Config config = new Config();
        config.useSingleServer().setAddress(this.getHost()+":"+this.getPort()).setDatabase(0);
        return (Redisson) Redisson.create(config);
    }

    public static Redisson getReddsion(){
        Config config = new Config();
        config.useSingleServer().setAddress("redis://134.175.117.176:7000").setDatabase(0);
        return (Redisson) Redisson.create(config);
    }
}
